package com.sgb.kjwl.view.ui.adapter.enterprise;

import android.content.Context;

import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;

import com.sgb.kjwl.BR;
import com.sgb.kjwl.R;
import com.sgb.kjwl.databinding.ItemIpPickSelectBinding;
import com.sgb.kjwl.model.entity.enterprise.IpPickSelectEntity;
import com.swgk.core.recyclerview.adapter.BaseRecycleAdapter;
import com.swgk.core.recyclerview.adapter.ItemViewHolder;

import java.util.List;

public class IpPickSelectAdapter extends BaseRecycleAdapter<IpPickSelectEntity> {

    ItemIpPickSelectBinding binding;
    @DrawableRes int color;

    public IpPickSelectAdapter(Context context, List<IpPickSelectEntity> datas) {
        super(context, R.layout.item_ip_pick_select, datas);
    }

    public IpPickSelectAdapter(Context context, List<IpPickSelectEntity> datas, @DrawableRes int color ) {
        super(context, R.layout.item_ip_pick_select, datas);
        this.color = color;
    }

    @Override
    public void convert(ItemViewHolder holder, IpPickSelectEntity ipPickSelectEntity) {
        holder.setBinding(BR.viewModel, ipPickSelectEntity);
        binding = (ItemIpPickSelectBinding) holder.getmBinding();
        if (color != 0){
            binding.rootLayout.setBackground(context.getResources().getDrawable(color));
        }
    }

}
